package woda.ink.mapper;

import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestBody;
import woda.ink.entity.fileEntity;
import woda.ink.entity.loginEntity;

import java.util.List;

@Mapper
public interface Commom {
    @Insert("${sql}")
    int InsertSql(@Param("sql")String sql);
    @Insert("insert into plateform_file (type,url,title,fileExplain,leader,link,fileName) value (#{type},#{url},#{title},#{fileExplain},#{leader},#{link},#{fileName})")
    int InsertResourse(fileEntity fileEntity);
    @Update("${sql}")
    int UpdateSql(@Param("sql")String sql);

    @Select("select * from plateform_Employee where loginName = #{LoginName}")
    loginEntity login(@Param("LoginName") String LoginName);

    @Select("${sql}  ")
    String count(@Param("sql")String sql);

    @Select("${sql}")
    List<fileEntity> SourseListMapper(@Param("sql")String sql);

    @Select("select * from plateform_typeConf")
    List<fileEntity> typeConf();

    @Select("${sql} ")
    List<loginEntity> EmployeeListMapper(@Param("sql")String sql);

    @Select("${sql} ")
    fileEntity EditSourceMapper(@Param("sql")String sql);

    @Select("${sql}")
    loginEntity EditEmployeeMapper(@Param("sql")String sql);

    @Update("update plateform_file set type = #{type},title =#{title},fileExplain = #{fileExplain},link=#{link} where sourseID = #{sourseID}")
    int UpdateOneFile(fileEntity fileEntity);

    @Delete("${sql}")
    int deleteOne(@Param("sql") String sql);

    @Update("update plateform_Employee set loginName = #{loginName},password =#{password},power = #{power} ,realName = #{realName},phone = #{phone},depart=#{depart} where employeeID = #{employeeID}")
    int UpdateOneEmployee(loginEntity loginEntity);

    @Insert("insert into plateform_Employee (loginName,password,power,realName,phone,depart) value(#{loginName},#{password},#{power},#{realName},#{phone},#{depart})")
    int addEmployee(loginEntity loginEntity);
}
